package com.example.jdbc_demo.mapper;

import com.example.jdbc_demo.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;


@Mapper
public interface UserMapper {
    @Select("select * from students where id = #{id}")
    public User getUser(Integer id);

    //根据用户名查询
    @Select("select * from students where name=#{name}")
    public List<User> getUserByUsername(String name);


    @Insert("insert into students(id,name,gender,nation,classID,score) values(#{id},#{name},#{gender},#{nation},#{classID},#{score})")
    public int addUser(Integer id, String name, String gender, String nation, String classID, Integer score);


    @Delete("delete from students where id = #{id}")
    public int deleteUser(Integer id);


    @Update("update students set score=#{score}")
    public int updateUser(Integer score);

}
